<?php $loginPic = M('CustEntity')->getFieldByCustId(spotSek($sek),'cust_img');?>
<script type="text/javascript" src="/statics/js/jquery.lazyload.js"></script>
<div id="options-examples">
<div class="page-index">
<div class="toubu">
	<div class="face"><img src="<?=$loginPic?>" width="30"></div>
    <div class="toubu-ss">
    	<form action="/goods/glist" method="get">
        <input type="hidden" name="sek" value="<?=$sek?>" />
        <p><input type="text" placeholder="请输入商品关键词" name="keyword" /></p></form>
    </div>
</div>
<div id="scrollimg" class="scrollimg">
  <div class="bd">
    <ul>
      <?php if($slideMain){foreach($slideMain AS $val){?>
      <li><a href="<?=$val['click_url']? $val['click_url'].'/sek/'.$sek : ''; ?>" target="_blank"><img src="<?=transUrl($val['pic_url'])?>" width="100%" /></a></li>
      <?php }}?>
    </ul>
  </div>
  <div class="hd">
    <ul>
    </ul>
  </div>
</div>
<script type="text/javascript">
    TouchSlide({ 
        slideCell:"#scrollimg",
        titCell:".hd ul", //开启自动分页 autoPage:true ，此时设置 titCell 为导航元素包裹层
        mainCell:".bd ul", 
        effect:"leftLoop", 
        autoPage:true,//自动分页
        autoPlay:true //自动播放
    });
</script>
<p><img src="/statics/img/refund.png" style="width:100%" /></p>
<div class="guan">
<div class="head qg xppp">
    <span>专题馆</span></div>
    <div class="guan2">
	<ul>
		<?php if($cateEntity){foreach($cateEntity AS $val){?>
    	<li><a href="/goods/glist/cid/<?=$val['cate_id']?>/plv/<?=$val['parent_id']?>/sek/<?=$sek?>/?sales=dw"><img class="lazys" src="/statics/images/lazy.png" data-original="<?=transUrl($val['spread_pic'])?>" width="100%"></a></li>
    	<?php }}?>
    </ul>
    </div>
</div>
    
<div class="index-ad" id="left-float-side"><a href="/goods/glist/oem/1/sek/<?=$sek?>"><img src="/statics/images/index-ad.jpg" width="100%" /></a></div>
<div class="index-ad side" style="display: none;"><a href="/goods/glist/oem/1/sek/<?=$sek?>"><img src="/statics/images/index-ad.jpg" width="100%" /></a><span></span></div>

<div class="list">
  <div class="head qg xppp">
      <a class="mores" href="/goods/glist/sek/<?=$sek?>/?news=dw">more<i></i></a>
    <span>最新上线</span></div>
  <div class="cp">
	<ul>
		<?php if($lastGoods){foreach($lastGoods AS $val){?>
    	<li>
            <a href="/goods/detail/id/<?=$val['goods_id']?>/sek/<?=$sek?>"><img class="lazys" src="/statics/images/lazy.png" data-original="<?=transUrl($val['goods_pic'])?>" width="100%"></a>
            <p><a href="/goods/detail/id/<?=$val['goods_id']?>/sek/<?=$sek?>"><?=$val['goods_title']?></a></p>
            <p class="pay">
                <span class="icon-gouwu2" onclick="putCart(this)">
                    <!--<img src="/statics/images/show_ico4.png" width="15">-->
                </span>
                ¥<?=$val['goods_price']?>
            </p>
            <input type="hidden" value="{{$val['goods_id']}}" class="goodsId" />
        </li>
        <?php }}?>
	</ul>
  </div>
</div>

<div class="list">
  <div class="head qg xppp">
    <span>热销</span></div>
  <div class="cp">
	<script type="text/javascript">  
	$(document).ready(function(){  
		var range = 50; //距下边界长度/单位px  
		var elemt = 500; //插入元素高度/单位px  
		var maxnum = 20; //设置加载最多次数  
		var num = 1; page = 0;doreturn = 1;
		var totalheight = 0;  
		var main = $("#content"); //主体元素  
		$(window).scroll(function(){  
			var srollPos = $(window).scrollTop(); //滚动条距顶部距离(页面超出窗口的高度)  
			//console.log("滚动条到顶部的垂直高度: "+$(document).scrollTop());  
			//console.log("页面的文档高度 ："+$(document).height());  
			//console.log('浏览器的高度：'+$(window).height());  
			totalheight = parseFloat($(window).height()) + parseFloat(srollPos);  
			if(($(document).height()-range) <= totalheight && num != maxnum && doreturn > 0) {
				$('.ajaxing').remove();
				doreturn = 0;$('#content').append('<center class="ajaxing" style="margin-top:18px"><img src="/statics/images/ajaxing.gif" /></center>');
				$.get('/index/index',{'page':(parseInt(page)+1),'hotAjax':'1','sek':'<?=$sek?>'},function(data){
					$('.ajaxing').remove();
					if(data.code == '0'){
						doreturn = 0;return false;						
					}
					page = data.page;
					main.append(data.data);  
					num++;doreturn = 1;
					$(".lazys").lazyload();
				},'json');
				
			}  
		});  
	});  
	</script>
    <div id="content" class="cp"></div>
  </div>
</div>
</div>
</div>

<div class="footer" style="margin-bottom: 21px;">
	<p style="display:none"><img src="/statics/img/foot_logo.png" width="100px"></p>
	<p>潜海科技提供技术支持</p>
    <p>浙ICP备16013057号</p>
</div>
<div class="footer" style="display:none">
  <dl>
  	<dt><img src="/statics/img/ft1.png" width="20"></dt>
    <dd class="ft1">100%正品</dd>
    <dd class="ft2">全球精选 正品保障<br></dd>
  </dl>
</div>
<div class="fiex nav"> <a class="icon-shouye fiex_on" href="/index/index/sek/<?=$sek?>"><br />
  首页</a> <a class="icon-fenlei" href="/cate/main/sek/<?=$sek?>"><br />
  分类</a> <a class="icon-gouwu" href="/cart/index/sek/<?=$sek?>"><span id="cartSum"></span><br />
  购物车</a> <a class="icon-geren" href="/index/user/sek/<?=$sek?>"><br />
  用户中心</a> </div>

<div class="top"></div>

<div class="che-true">
    <p>已加入购物车</p>
</div>


<script>
$(function(){
/*     _height = $(this).scrollTop();
    setInterval(function(){
        if($(this).scrollTop() == _height){
            $('.nav').animate({ bottom: '0px' }, 300);           
        }else{
            $('.nav').animate({ bottom: '-100px' }, 300);
             _height = $(this).scrollTop();
        }
    },400);  */
	$('.nav').animate({ bottom: '0px' }, 300);
    cartSum();
});
function putCart(_this){
    var Id = $(_this).parent().siblings('input[type="hidden"]').val();
    $.get('/cart/putCart',{'goods_id':Id,'nums':1,'sek':'<?=$sek?>'},function(data){
        if(data.code == '1'){
            $('.che-true').css('display','block').addClass('che-true2');
            setTimeout(time,2500);
            function time(){
                $('.che-true').css('display','none');
                cartSum();
            }
        }else{
            alert(data.msg);
        }
    },'json');
}
</script>
<script>
	window.onload = function(){
        var close = false;
		var silerHeight =  $('#left-float-side').offset().top;
		$(window).scroll(function(){
			var top = $(this).scrollTop();
			if(top>=silerHeight){
                $('.top').css('display','block');
                if(close == false){
                    $('.side').css('display','block');
                    $('.side span').css('display','block');
                    $('.side').css('position','fixed');
                }
			}else{
                $('.side').css('display','none');
				$('.top').css('display','none');
			}
		});
        $('.side span').click(function(){
            close = true;
            $('.side').css('display','none');
        });
		$('.top').click(function(){
			$('body').animate({scrollTop:0},1000)
		})
	};
</script>
